home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / il / ilWarp.z / ilWarp
Encoding:
Text File  |  2002-10-03  |  17.0 KB  |  397 lines

  1.  
  2.  
  3.  
  4. iiiillllWWWWaaaarrrrpppp((((3333))))          IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          iiiillllWWWWaaaarrrrpppp((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      iiiillllWWWWaaaarrrrpppp - general 3D warp operations
  10.  
  11. IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
  12.      ilWatchedObject
  13.  
  14. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  15.      #include <il/ilWarp.h>
  16.  
  17. CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.      The ilWarp class encapsulates general 3D coordinate transformations for
  19.      use by ilWarpImg and subclasses thereof.  A particular warp is defined by
  20.      overriding the eeeevvvvaaaallll() virtual.  Several other virtuals can be overridden
  21.      to enable more efficient batch evaluation, inversion, composition, and so
  22.      forth.
  23.  
  24.      The ilWarp class contains one pure virtual method, ccccooooppppyyyy(), so it is not
  25.      possible to construct an ilWarp object, and any concrete derived class
  26.      must implement the copy virtual.  The ilWarpImg operator relies on the
  27.      copy method to maintain an internal copy of a user-supplied warp.
  28.  
  29.      ilWarp is derived from ilWatchedObject.  This makes it possible to set a
  30.      "dynamic" warp object on an ilWarpImg --- one that is not copied, but
  31.      instead "watched" for any changes.  When the warp changes, the ilWarpImg
  32.      responds appropriately.  This implies that any class that is derived from
  33.      ilWarp must trigger the appropriate notification whenever it is changed.
  34.      In particular the non-const virtual methods iiiiddddeeeennnnttttiiiittttyyyy(), iiiinnnnvvvveeeerrrrtttt(),
  35.      ccccoooommmmppppoooosssseeee(), and iiiinnnnffffeeeerrrr() should call the protected method wwwwaaaarrrrppppCCCChhhhaaaannnnggggeeeedddd().
  36.      (However, if any of these methods fails and leaves the warp unchanged the
  37.      wwwwaaaarrrrppppCCCChhhhaaaannnnggggeeeedddd() method should not be called.)
  38.  
  39.      ilWarp provides several alternative means to evaluate the warp that it
  40.      specifies.  The principal one is eeeevvvvaaaallll() which must be defined by a
  41.      derived class.  The others are xxxx(), yyyy(), and zzzz(), which evaluate the
  42.      components of the warp, ddddxxxx(), ddddyyyy(), and ddddzzzz(), which evaluate the Jacobian
  43.      of the warp,
  44.  
  45. CCCCLLLLAAAASSSSSSSS MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN SSSSUUUUMMMMMMMMAAAARRRRYYYY
  46.      CCCCooooppppyyyyiiiinnnngggg
  47.  
  48.           virtual ilWarp* copy()
  49.  
  50.      WWWWaaaarrrrpppp eeeevvvvaaaalllluuuuaaaattttiiiioooonnnn mmmmeeeetttthhhhooooddddssss
  51.  
  52.           virtual void eval(float& x, float& y, float& z, float u,
  53.                             float v, float w)
  54.           void eval(float& x, float& y, float u, float v)
  55.           virtual float x(float u, float v=0, float w=0)
  56.           virtual float y(float u, float v=0, float w=0)
  57.           virtual float z(float u, float v=0, float w=0)
  58.           virtual void dx(float& x, float& y, float& z, float u,
  59.                           float v=0, float w=0)
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. iiiillllWWWWaaaarrrrpppp((((3333))))          IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          iiiillllWWWWaaaarrrrpppp((((3333))))
  71.  
  72.  
  73.  
  74.           virtual void dy(float& x, float& y, float& z, float u,
  75.                           float v=0, float w=0)
  76.           virtual void dz(float& x, float& y, float& z, float u,
  77.                           float v=0, float w=0)
  78.           virtual ilStatus getBBox(iflXYZfloat& min, iflXYZfloat& max,
  79.                                    int su, int sv, int sw, int nu,
  80.                                    int nv, int nw)
  81.           ilStatus getBBox(iflXYZfloat& min, iflXYZfloat& max, int su,
  82.                            int sv, int nu, int nv)
  83.           virtual void evalVector(float upos, float vpos, float ustep,
  84.                                   iflXYfloat *addrs, int count,
  85.                                   float wpos=0)
  86.           void findRoot(const iflXYZfloat& xy, iflXYZfloat& uv,
  87.                         int tries, float xyzTol, float uvwTol)
  88.           iflXYZfloat operator()(float u, float v, float w)
  89.           iflXYfloat operator()(float u, float v)
  90.           iflXYZfloat operator()(const iflXYZfloat& p)
  91.           iflXYfloat operator()(const iflXYfloat& p)
  92.  
  93.      WWWWaaaarrrrpppp mmmmaaaannnniiiippppuuuullllaaaattttiiiioooonnnn
  94.  
  95.           virtual void identity()
  96.           virtual ilStatus invert(ilWarpQuality quality=ilWarpBest,
  97.                                   float ulo=0, float uhi=1, float vlo=0,
  98.                                   float vhi=1, float wlo=0, float whi=0)
  99.           virtual ilStatus compose(const ilWarp& other,
  100.                                    ilWarpQuality quality=ilWarpBest)
  101.           virtual ilStatus infer(ilTiePointList& tiePoints,
  102.                                  ilWarpQuality quality=ilWarpBest)
  103.           virtual int minimumNumberOfTies()
  104.  
  105.      AAAAlllltttteeeerrrraaaattttiiiioooonnnn ccccaaaallllllllbbbbaaaacccckkkk mmmmeeeetttthhhhooooddddssss
  106.  
  107.           void warpChanged()  _p_r_o_t_e_c_t_e_d
  108.  
  109.  
  110. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  111.      ccccoooommmmppppoooosssseeee(((())))
  112.  
  113.           virtual ilStatus compose(const ilWarp& other,
  114.                                    ilWarpQuality quality=ilWarpBest)
  115.  
  116.  
  117.           Compose this warp with another. This object is updated to reflect
  118.           the composite transformation equivalent to applying
  119.           (*this)(other(p)).  The default implementation returns ilFAILED.  If
  120.           quality is ilWarpExact, then the method should return ilOKAY only if
  121.           the precise composition can be computed.  Otherwise it should return
  122.           ilFAILED.  If quality is ilWarpBest, then the method can return
  123.           ilAPPROXIMATE if only an approximate composition can be computed.
  124.           If the composition operation fails, then this object should be
  125.           unmodified.
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. iiiillllWWWWaaaarrrrpppp((((3333))))          IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          iiiillllWWWWaaaarrrrpppp((((3333))))
  137.  
  138.  
  139.  
  140.      ccccooooppppyyyy(((())))
  141.  
  142.           virtual ilWarp* copy()
  143.  
  144.  
  145.           This is a pure virtual method that allocates a duplicate of the warp
  146.           object.  It is used by ilWarpImg to maintain an internal copy of the
  147.           warp passed by ilWarpImg::setWarp().
  148.  
  149.      ddddxxxx(((())))
  150.  
  151.           virtual void dx(float& x, float& y, float& z, float u,
  152.                           float v=0, float w=0)
  153.  
  154.  
  155.           Evaluate the partial derivatives (dx/du,dy/du,dz/du) of the warp
  156.           function at the point (u,v,w).  The default implementation returns
  157.           zeros.
  158.  
  159.      ddddyyyy(((())))
  160.  
  161.           virtual void dy(float& x, float& y, float& z, float u,
  162.                           float v=0, float w=0)
  163.  
  164.  
  165.           Evaluate the partial derivatives (dx/dv,dy/dv,dz/dv) of the warp
  166.           function at the point (u,v,w).  The default implementation returns
  167.           zeros.
  168.  
  169.      ddddzzzz(((())))
  170.  
  171.           virtual void dz(float& x, float& y, float& z, float u,
  172.                           float v=0, float w=0)
  173.  
  174.  
  175.           Evaluate the partial derivatives (dx/dw,dy/dw,dz/dw) of the warp
  176.           function at the point (u,v,w).  The default implementation returns
  177.           zeros.
  178.  
  179.      eeeevvvvaaaallll(((())))
  180.  
  181.           virtual void eval(float& x, float& y, float& z, float u,
  182.                             float v, float w)
  183.  
  184.  
  185.           void eval(float& x, float& y, float u, float v)
  186.  
  187.  
  188.           This is a convenience method to evaluate all three coordinates of
  189.           the transformation and return the result in a structure.  The 2D
  190.           version assumes that w = 0.
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. iiiillllWWWWaaaarrrrpppp((((3333))))          IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          iiiillllWWWWaaaarrrrpppp((((3333))))
  203.  
  204.  
  205.  
  206.      eeeevvvvaaaallllVVVVeeeeccccttttoooorrrr(((())))
  207.  
  208.           virtual void evalVector(float upos, float vpos, float ustep,
  209.                                   iflXYfloat *addrs, int count,
  210.                                   float wpos=0)
  211.  
  212.  
  213.           Perform the equivalent of
  214.  
  215.           for (int i=0; i<count; i++) {
  216.               float z;
  217.               eval(addrs[i].x, addrs[i].y, z, upos+ustep*i, vpos, wpos);
  218.           }
  219.  
  220.  
  221.           for use by the ilWarpImg address generation function.  This function
  222.           should be optimized as much as possible by derived classes in order
  223.           to achieve good ilWarpImg performance.
  224.  
  225.      ffffiiiinnnnddddRRRRooooooootttt(((())))
  226.  
  227.           void findRoot(const iflXYZfloat& xyz, iflXYZfloat& uvw,
  228.                         int tries, float xyzTol, float uvwTol)
  229.  
  230.  
  231.           Search numerically for the solution to
  232.  
  233.               xyz = warp(uvw).
  234.  
  235.  
  236.           The search terminates when one of the following conditions is met:
  237.           (1) the number of iterations exceeds _t_r_i_e_s, (2) the difference
  238.           between successive approximations is <= _x_y_z_T_o_l, or (3) the
  239.           difference between (_x_y_z) and warp(_u_v_w) is <= _u_v_w_T_o_l.
  240.  
  241.      ggggeeeettttBBBBBBBBooooxxxx(((())))
  242.  
  243.           ilStatus getBBox(iflXYZfloat& min, iflXYZfloat& max, int su,
  244.                            int sv, int nu, int nv)
  245.           virtual ilStatus getBBox(iflXYZfloat& min, iflXYZfloat& max,
  246.                                    int su, int sv, int sw, int nu,
  247.                                    int nv, int nw)
  248.  
  249.  
  250.           Return the bounding box of the mapped rectangle with corners
  251.           (su,sv,sw) and (su+nu,sv+nv,sw+nw).  The lower-left and upper-right
  252.           vertices of the box are returned in the min and max structures,
  253.           respectively.  The default implementation is by sampling the
  254.           boundary of the input rectangle at a fixed granularity and computing
  255.           the bounding box of the mapped set of sample points.  It returns
  256.           ilOKAY if the computation is successful and ilFAILED otherwise.  The
  257.           2D version assumes sw == 0 and nw == 1.
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. iiiillllWWWWaaaarrrrpppp((((3333))))          IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          iiiillllWWWWaaaarrrrpppp((((3333))))
  269.  
  270.  
  271.  
  272.      iiiiddddeeeennnnttttiiiittttyyyy(((())))
  273.  
  274.           virtual void identity()
  275.  
  276.  
  277.           Sets the warp to the identity function.  The default implementation
  278.           does nothing.
  279.  
  280.      iiiinnnnffffeeeerrrr(((())))
  281.  
  282.           virtual ilStatus infer(ilTiePointList& tiePoints,
  283.                                  ilWarpQuality quality=ilWarpBest)
  284.  
  285.  
  286.           Infer the warp from a set of point correspondences in the input and
  287.           output spaces.  See ccccoooommmmppppoooosssseeee() for the interpretation of the quality
  288.           argument.  The default implementation returns ilFAILED.  This method
  289.           must be defined by any subclass that will be used by ilTieWarpImg.
  290.  
  291.      iiiinnnnvvvveeeerrrrtttt(((())))
  292.  
  293.           virtual ilStatus invert(ilWarpQuality quality=ilWarpBest,
  294.                                   float ulo=0, float uhi=1, float vlo=0,
  295.                                   float vhi=1, float wlo=0, float whi=0)
  296.  
  297.  
  298.           Invert the warp over the domain specified by the rectangle
  299.           (ulo,vlo,wlo) to (uhi,vhi,whi).  The accuracy of the inverse outside
  300.           this rectangle is undefined.  See ccccoooommmmppppoooosssseeee() for the interpretation
  301.           of the quality argument.  The default implementation uses iiiinnnnffffeeeerrrr() to
  302.           guess the inverse via a set of tie points.
  303.  
  304.      mmmmiiiinnnniiiimmmmuuuummmmNNNNuuuummmmbbbbeeeerrrrOOOOffffTTTTiiiieeeessss(((())))
  305.  
  306.           virtual int minimumNumberOfTies()
  307.  
  308.  
  309.           Return the minimum number of tie points necessary to infer the warp.
  310.           The default implementation returns INT_MAX.
  311.  
  312.      ooooppppeeeerrrraaaattttoooorrrr(((())))
  313.  
  314.           iflXYZfloat operator()(const iflXYZfloat& p)
  315.  
  316.  
  317.           iflXYZfloat operator()(float u, float v, float w)
  318.  
  319.  
  320.           iflXYfloat operator()(const iflXYfloat& p)
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. iiiillllWWWWaaaarrrrpppp((((3333))))          IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          iiiillllWWWWaaaarrrrpppp((((3333))))
  335.  
  336.  
  337.  
  338.           iflXYfloat operator()(float u, float v)
  339.  
  340.  
  341.           The () operator provides convenient means to evaluate the warp
  342.           function at a point.  wwwwaaaarrrrppppCCCChhhhaaaannnnggggeeeedddd(((())))
  343.  
  344.           void warpChanged()  _p_r_o_t_e_c_t_e_d
  345.  
  346.  
  347.           This method should be called by a derived class whenever the warp is
  348.           altered.  It is used by ilWarpImg to notice changes in a dynamic
  349.           warp.
  350.  
  351.      xxxx(((())))
  352.  
  353.           virtual float x(float u, float v=0, float w=0)
  354.  
  355.  
  356.           Evaluate the x component of the warp function at a point.  The
  357.           default implementation is to return u.  This virtual should be
  358.           overridden by any derived class that transforms the x component.
  359.  
  360.      yyyy(((())))
  361.  
  362.           virtual float y(float u, float v=0, float w=0)
  363.  
  364.  
  365.           Evaluate the y component of the warp function at a point.  The
  366.           default implementation is to return v.  This virtual should be
  367.           overridden by any derived class that transforms the y component.
  368.  
  369.      zzzz(((())))
  370.  
  371.           virtual float z(float u, float v=0, float w=0)
  372.  
  373.  
  374.           Evaluate the z component of the warp function at a point.  The
  375.           default implementation is to return w.  This virtual should be
  376.           overridden by any derived class that transforms the z component.
  377.  
  378. IIIINNNNHHHHEEEERRRRIIIITTTTEEEEDDDD MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS
  379.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm iiiillllWWWWaaaattttcccchhhheeeeddddOOOObbbbjjjjeeeecccctttt
  380.      addWatchCallback(), doWatchCallbacks(), removeWatchCallback()
  381.  
  382.  
  383. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  384.      ilWarpImg, ilPolyWarp, ilAffineWarp, ilPolyDef, ilTieWarpImg
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.